Conversation
97a2bde to
74e0bc1
Compare
77b2ee2 to
d6a79e6
Compare
22803a9 to
5df5f53
Compare
5bc4989 to
2c9a086
Compare
…tom-mustache-behavior
…tom-mustache-behavior
| if (!Array.isArray(value)) return null; | ||
|
|
||
| // Check if array contains attachments or image URLs (supports mixed arrays) | ||
| const allValid = value.every( |
There was a problem hiding this comment.
The flow is that the backend will attempt to turn all the references into URLs. Now if something goes wrong and one of the attachments isn't turned into a URL this would still allow expansion by ensuring the other values are attachments.
A different flow I experimented with was passing the attachment map from the backend for verification. I did not like that mixing of concerns though so I did not think it was a good idea to introduce that logic here.
3b336e3 to
308b664
Compare
308b664 to
635d262
Compare
|
@ankrgyl Not sure if you had time to try this out with the other changes but I just updated them with main. Let me know if this makes sense. One other thing I had considered was passing the attachment map so I really really knew the type of attachment but currently the image_url is working for everything valid (ie. pdf when really pdf is a file). I definitely kept passing image variables into text so many times sadly which confused me a lot. |
…tom-mustache-behavior
b282a99 to
cf24e7d
Compare
…tom-mustache-behavior
|
@ibolmo I rebased these changes after the conflicts from the removal of the nunjucks package. No changes there at this time as the default is flipped to escape html |
Users would like to be able to reference an array when handling images.
This PR introduces the following changes:
Variables that contain arrays of images or files will now be automatically expanded when used everything is a link or an attachment. Backend changes attachment types to links, if everything goes right you have a full array of links, attachment references could be in the variable if links are not found, unlikely in practice.
See attachment link resolution tests here for link resolution: https://github.com/braintrustdata/braintrust/pull/9983/changes